﻿/*----------------------------------------------------------------
// Copyright (C) 2011 上海
// 版权所有。 
//
// 文件名：DataAccessWindowBusinessSummary
// 文件功能描述：窗口营业汇总表数据访问层
//
// 
// 创建标识：2012-07-04 王冲
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbAdapter.sqldbAdapter;
using System.Data;
using System.Data.SqlClient;

namespace DAO.WaiGaoQiao
{
    public class DataAccessWindowBusinessSummary
    {
        /// <summary>
        /// 获取消费组列表（用于绑定下拉框）
        /// </summary>
        /// <returns></returns>
        public DataSet GetNode()
        {
            using (SqlConnection conn = new SqlConnection(GetConntionString.conntionstring()))
            {
                sqldb db = new sqldb();
                string query = "select nodeid,nodename from yax_node where nodeid in(1,2,3) order by nodeid";
                DataSet ds = db.ExecuteDataset(conn, CommandType.Text, query);
                return ds;
            }
        }

        public DataSet GetList(string strst, string stret, string strnodeid)
        {
            sqldb db = new sqldb();
            SqlParameter[] parameters = {
                    new SqlParameter("@BDATE", SqlDbType.DateTime),
                    new SqlParameter("@EDATE",SqlDbType.DateTime),
                    new SqlParameter("@NODE_PARAMTERS", SqlDbType.VarChar,10)
                    };
            parameters[0].Value = strst;
            parameters[1].Value = stret;
            parameters[2].Value = strnodeid;
            DataSet ds = db.ExecuteDataset(GetConntionString.conntionstring(), CommandType.StoredProcedure, "Proc_CON_MAC_HZ", parameters);
            return ds;
        }

        public DataSet GetPeriod()
        {
            using (SqlConnection conn = new SqlConnection(GetConntionString.conntionstring()))
            {
                sqldb db = new sqldb();
                string query = "select PeriodCode,BeginTime,NextDay from Con_Period where PeriodCode=1 union "+                               "select PeriodCode,EndTime,NextDay from Con_Period where PeriodCode=4";
                DataSet ds = db.ExecuteDataset(conn, CommandType.Text, query);
                return ds;
            }
        }
    }
}
